# 石头剪刀布游戏
# 用户输入的demo

import random  

# options you can  choose in the game
choices = ["rock", "paper", "scissors"]

# function to determine a winner
def judgement(playerChoice: str, computerChoice: str):
    if playerChoice == computerChoice:
        return  'tie'
    elif playerChoice == "rock" and computerChoice == "scissors":
        return 'player win'
    elif playerChoice == "paper" and computerChoice == "rock":
        return 'player win'
    elif playerChoice == "scissors" and computerChoice == "paper":
        return 'player win'
    else:
        return 'computer win'
    
print("Let's play a game of Rock, Paper, Scissors!")
print("Choose your weapon below: rock, paper, scissors!", "\n")

# player input
playerChoice = input("Enter your choice: ")

if playerChoice not in choices:
    print("Invalid choice! Retry!")
    playerChoice = input("Enter your choice: ")
else:
    computerChoice = random.choice(choices)
    print("computer choose: ", computerChoice,"\n")
    result = judgement(playerChoice, computerChoice)
    print("Finally:",result,"\n")